<%@ Page Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="Posts.aspx.cs" Inherits="FreeLancer.HRB.WebApp.Admin.Pages.Posts" Title="<%$ Resources:labels, posts %>" %>

<%@ Register Assembly="DevExpress.Web.ASPxEditors.v8.1, Version=8.1.1.0, Culture=neutral, PublicKeyToken=49d90c14d24271b5"
  Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dxe" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v8.1, Version=8.1.1.0, Culture=neutral, PublicKeyToken=49d90c14d24271b5"
  Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dxwgv" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
  <div style="margin-bottom: 10px;">
    <span><%=Resources.labels.category %></span>
      <asp:DropDownList runat="server" ID="cboCategory" Width="250px"
        OnSelectedIndexChanged="cboCategory_SelectedIndexChanged" AutoPostBack="true">
        <%--<asp:ListItem Selected="True" Value="0" Text="<%$ Resources:labels, noneItem %>">
        </asp:ListItem>--%>
      </asp:DropDownList>
      &nbsp;&nbsp;&nbsp;
    <span><%=Resources.labels.language %></span>
    <asp:DropDownList runat="server" ID="cboLanguage" Width="100px" 
      OnSelectedIndexChanged="cboLanguage_SelectedIndexChanged" AutoPostBack="true">
    </asp:DropDownList>
  </div>
  <div class="settings">
    <dxwgv:ASPxGridView ID="ASPxGridViewPosts" runat="server"
      AutoGenerateColumns="False" KeyFieldName="PostId"
          SettingsEditing-Mode="Inline" 
          SettingsPager-Visible="true" 
          SettingsBehavior-ConfirmDelete="true"
          SettingsText-CommandCancel="<%$ Resources:labels, cmdCancel %>"
          SettingsText-ConfirmDelete="<%$ Resources:labels, cmdConfirmDelete %>"
          SettingsText-CommandUpdate="<%$ Resources:labels, cmdUpdate %>" 
          Width="1000px"
          OnHtmlRowPrepared="ASPxGridViewPosts_OnHtmlRowPrepared"
          OnRowDeleting="ASPxGridViewPosts_OnDeleting"
          OnRowUpdating="ASPxGridViewPosts_OnUpdating">
        <Settings ShowFilterRow="True"/>
        <Columns>
          <dxwgv:GridViewCommandColumn VisibleIndex="0" Width="100px">
            <EditButton Visible="True" Text="<%$ Resources:labels, cmdUpdate %>">
            </EditButton>
            <DeleteButton Visible="True" Text="<%$ Resources:labels, cmdDelete %>">
            </DeleteButton>
            <ClearFilterButton Visible="True" Text="<%$ Resources:labels, cmdClearFilter %>">
            </ClearFilterButton>
            <CancelButton Text="<%$ Resources:labels, cmdCancel %>">
            </CancelButton>
            <HeaderStyle HorizontalAlign="Center" />
          </dxwgv:GridViewCommandColumn>
          <dxwgv:GridViewDataHyperLinkColumn VisibleIndex="0" Width="70px" FieldName="PostId" Caption=" " 
            HeaderStyle-HorizontalAlign="Center" ReadOnly="true">
            <PropertiesHyperLinkEdit NavigateUrlFormatString="EditPost.aspx?Id={0}"
              Text="<%$ Resources:labels, viewDetail %>">
            </PropertiesHyperLinkEdit>
          </dxwgv:GridViewDataHyperLinkColumn>
          <dxwgv:GridViewDataTextColumn Caption="ID" FieldName="PostId" Visible="false">
          </dxwgv:GridViewDataTextColumn>
          <dxwgv:GridViewDataTextColumn Caption="<%$ Resources:labels, title %>" 
            FieldName="Title" VisibleIndex="1">
            <PropertiesTextEdit>
              <ValidationSettings>
                <RequiredField ErrorText="<%$ Resources:labels, titleReqMsg %>" IsRequired="True" />
              </ValidationSettings>
            </PropertiesTextEdit>
            <HeaderStyle HorizontalAlign="Center" />
          </dxwgv:GridViewDataTextColumn>
          <dxwgv:GridViewDataDateColumn Caption="<%$ Resources:labels, dateModified %>" VisibleIndex="2" Width="150px"
            FieldName="DateModified" ReadOnly="true">
            <PropertiesDateEdit DisplayFormatString="G">
            </PropertiesDateEdit>
            <HeaderStyle HorizontalAlign="Center" />
          </dxwgv:GridViewDataDateColumn>
          <dxwgv:GridViewDataTextColumn Caption="<%$ Resources:labels, author %>" 
            FieldName="Author" VisibleIndex="3" Width="100px" ReadOnly="true">
            <HeaderStyle HorizontalAlign="Center" />
          </dxwgv:GridViewDataTextColumn>
          <%--<dxwgv:GridViewDataMemoColumn Caption="<%$ Resources:labels, description %>" 
            FieldName="Description" VisibleIndex="3" Width="200px">
            <HeaderStyle HorizontalAlign="Center" />
          </dxwgv:GridViewDataMemoColumn>--%>
          <%--<dxwgv:GridViewDataDateColumn Caption="<%$ Resources:labels, dateCreated %>" VisibleIndex="4" Width="100px"
            FieldName="DateCreated" ReadOnly="true">
            <HeaderStyle HorizontalAlign="Center" />
          </dxwgv:GridViewDataDateColumn>--%>
          <dxwgv:GridViewDataCheckColumn Caption="<%$ Resources:labels, approved %>" VisibleIndex="4" Width="50px"
            FieldName="IsPublished">
            <HeaderStyle HorizontalAlign="Center" />
          </dxwgv:GridViewDataCheckColumn>
          <dxwgv:GridViewDataCheckColumn Caption="<%$ Resources:labels, comment %>" VisibleIndex="5" Width="50px"
            FieldName="IsCommentAllowed">
            <HeaderStyle HorizontalAlign="Center" />
          </dxwgv:GridViewDataCheckColumn>
          <%--<dxwgv:GridViewDataTextColumn Caption="<%$ Resources:labels, language %>" VisibleIndex="7" Width="70px"
            FieldName="Language" ReadOnly="true">
            <HeaderStyle HorizontalAlign="Center" />
          </dxwgv:GridViewDataTextColumn>--%>
        </Columns>
        <Templates>
          <DetailRow>
            <dxwgv:ASPxGridView ID="ASPxGridViewComments" runat="server"
              AutoGenerateColumns="False" KeyFieldName="PostCommentId"
              SettingsEditing-Mode="EditFormAndDisplayRow" 
              SettingsPager-Visible="true" 
              SettingsBehavior-ConfirmDelete="true"
              Settings-ShowTitlePanel="true"
              SettingsText-CommandCancel="<%$ Resources:labels, cmdCancel %>"
              SettingsText-ConfirmDelete="<%$ Resources:labels, cmdConfirmDelete %>"
              SettingsText-CommandUpdate="<%$ Resources:labels, cmdUpdate %>"
              SettingsText-Title="<%$ Resources:labels, comment %>"
              Width="100%"
              PreviewFieldName="Comment"
              OnBeforePerformDataSelect="ASPxGridViewComments_OnBeforePerformDataSelect"
              OnHtmlRowPrepared="ASPxGridViewComments_OnHtmlRowPrepared"
              OnRowDeleting="ASPxGridViewComments_OnDeleting"
              OnRowUpdating="ASPxGridViewComments_OnUpdating"
              OnRowInserting="ASPxGridViewComments_OnInserting" >
              <Columns>
                <dxwgv:GridViewCommandColumn VisibleIndex="0" Width="150px">
                  <NewButton Visible="True" Text="<%$ Resources:labels, cmdAnswer %>">
                  </NewButton>
                  <EditButton Visible="True" Text="<%$ Resources:labels, cmdUpdate %>">
                  </EditButton>
                  <DeleteButton Visible="True" Text="<%$ Resources:labels, cmdDelete %>">
                  </DeleteButton>
                  <ClearFilterButton Visible="True" Text="<%$ Resources:labels, cmdClearFilter %>">
                  </ClearFilterButton>
                  <CancelButton Text="<%$ Resources:labels, cmdCancel %>">
                  </CancelButton>
                  <HeaderStyle HorizontalAlign="Center" />
                </dxwgv:GridViewCommandColumn>
                <dxwgv:GridViewDataTextColumn Caption="ID" FieldName="PostCommentId" Visible="false">
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataDateColumn Caption="<%$ Resources:labels, dateModified %>" 
                  FieldName="CommentDate" VisibleIndex="1" Width="150px" ReadOnly="true">
                  <HeaderStyle HorizontalAlign="Center" />
                  <PropertiesDateEdit DisplayFormatString="G">
                  </PropertiesDateEdit>
                </dxwgv:GridViewDataDateColumn>
                <dxwgv:GridViewDataTextColumn Caption="<%$ Resources:labels, author %>" 
                  FieldName="Author" VisibleIndex="2" Width="100px" ReadOnly="true">
                  <HeaderStyle HorizontalAlign="Center" />
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataCheckColumn FieldName="IsApproved" Caption="<%$ Resources:labels, approved %>" 
                  VisibleIndex="4" Width="100px">
                  <HeaderStyle HorizontalAlign="Center" />
                </dxwgv:GridViewDataCheckColumn>
                <dxwgv:GridViewDataTextColumn Caption="">
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn FieldName="Comment" Visible="false">
                </dxwgv:GridViewDataTextColumn>
              </Columns>
              <Templates>
                <EditForm>
                  <div style="padding-left: 20px;">
                    <div>
                      <dxe:ASPxCheckBox ID="ASPxCheckBoxApproved" runat="server" 
                        Value='<%# Eval("IsApproved")%>' ValueType="System.Boolean"
                        Text="<%$ Resources:labels, approved %>">
                      </dxe:ASPxCheckBox>
                    </div>
                    <div style="padding: 4px; font-weight:bold;">
                      <span><%=Resources.labels.content %></span>
                    </div>
                    <dxe:ASPxMemo ID="ASPxMemoComment" runat="server" Height="150px" Text='<%# Eval("Comment")%>'
                      Width="100%">
                    </dxe:ASPxMemo>
                  </div>
                  <div style="text-align:right; padding:2px 2px 2px 2px">
                    <dxwgv:ASPxGridViewTemplateReplacement ID="UpdateButton" ReplacementType="EditFormUpdateButton" runat="server"></dxwgv:ASPxGridViewTemplateReplacement>
                    <dxwgv:ASPxGridViewTemplateReplacement ID="CancelButton" ReplacementType="EditFormCancelButton" runat="server"></dxwgv:ASPxGridViewTemplateReplacement>
                  </div>
                </EditForm>
                <PreviewRow>
                  <div style="padding-left:10px; padding-right: 10px;">
                    <%# Container.Text %>
                  </div>
                </PreviewRow>
              </Templates>
              <Settings ShowPreview="true"/>
                <SettingsPager Summary-Visible="true" AlwaysShowPager="true" Mode="ShowPager" PageSize="5">
                  <Summary AllPagesText="<%$ Resources:labels, postsAllPagesText %>" Text="<%$ Resources:labels, postsPageText %>" />
                </SettingsPager>
            </dxwgv:ASPxGridView>
          </DetailRow>
        </Templates>
        <SettingsDetail ShowDetailRow="true" AllowOnlyOneMasterRowExpanded="true"/>
        <SettingsPager Summary-Visible="true" AlwaysShowPager="true" Mode="ShowPager" PageSize="15">
          <Summary AllPagesText="<%$ Resources:labels, postsAllPagesText %>" Text="<%$ Resources:labels, postsPageText %>" />
        </SettingsPager>
    </dxwgv:ASPxGridView>
  </div>
</asp:Content>
